<?php
class Ab_PathFactory{
	private $path;
	private $pathType=null;
	
	function __construct($path){
		$this->path=$path;
	}
	
	function getPathType(){	
		//directory
		if(is_dir($this->path)){
			$this->pathType=new Ab_Directory($this->path);
		}
		//file
		elseif(is_file($this->path)){
			$this->pathType=new Ab_File($this->path);
			
			if(list($width, $height, $type, $attr) = @getimagesize($this->path)){
				$this->pathType=new Ab_Image($this->path);
			}
		}
		
		return $this->pathType;
	}
	
}
?>
